﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Metriks.Parsiranje.Klase;

namespace Metriks.Metrike.McCabe
{
    public class McCabeMetrika
    {
        List<LOC> lista;
        public McCabeMetrika(List<LOC> lista) {
            this.lista = lista;
        }
        public int getKompleksnost(){
            int brojac = 0;
            foreach(LOC l in lista){
                if(l is beginIf) brojac++;
                else if(l is elseIf) brojac++;
                else if(l is beginWhile) brojac++;
            }
            brojac++;
            return brojac;
        }
        public String assess()
        {
            return "Ciklomatska kompleksnost je: " + getKompleksnost();
        }
    }
}
